<?php
if (!defined('IN_CONTEXT')) die('access violation error!');
?>
<style type="text/css">
table {
	margin-top:2px;
}
table td {
	text-align:left;
}
.table_title {
	text-align:center;
}
</style>
<script type="text/javascript" language="javascript">
<!--
function check_checkitems_info(thisForm)
{
	$("#stat").css({"display":"block"});
	$("#stat").html("正在保存内容......");
	_ajax_submit(thisForm, on_success, on_failure);
	return false;
}

function on_success(response)
{
	response1 = eval("("+response+")");
	var stat = document.getElementById("stat");
	if(response1.result == 'ok')
	{
		alert(response1.sucmsg);
		stat.innerHTML = "OK，正在重定向......";
		reloadPage();
	}
	else if(response1.result == 'error')
	{
		stat.innerHTML = response1.errmsg;
	}
}

function on_failure(response)
{
	var stat = document.getElementById("stat");
	stat.innerHTML = response;
}
-->
</script>
<div id="stat" style="margin-top:20px;font-size:12px;display:none;"></div>
<p style='margin-top:20px;margin-bottom:0px;'><a style='font-size:12px;' href='index.php?_m=job&_a=editTemplatePage&tpl_id=<?php echo $tpl_id;?>'>测试页面</a>|<span style='font-size:12px;'>检测项页面</span></p>
<form action='index.php' method='post' onsubmit="javascript:return check_checkitems_info(this);">
<input type='hidden' name='_m' value='<?php echo $next_controller;?>'/>
<input type='hidden' name='_a' value='<?php echo $next_action;?>'/>
<input type='hidden' name='tpl_id' value='<?php echo $tpl_id;?>'>
<table width="100%" border="0" cellpadding="2" cellspacing="0" bordercolor="#4c4c4c">
<?php
$i = 1;
foreach($check_types as $v)
{
	echo "<tr><td style='font-size:13px;' class='table_title' colspan='2'>{$v['ct_name']}</td></tr>";
	foreach($check_items as $k1 => $v1)
	{
		if($v['ct_id'] == $k1)
		{
			foreach($v1 as $k2 => $v2)
			{
				if(in_array($k2,$tmp_templates))
				{
					echo "<tr><td>$i</td><td><input type='checkbox' checked='checked' value='$k2' id='$k2' name='{$v['ct_id']}_$k2'>{$v2}</td></tr>";
				}
				else
				{
					echo "<tr><td>$i</td><td><input type='checkbox' value='$k2' id='$k2' name='{$v['ct_id']}_$k2'>{$v2}</td></tr>";
				}
				$i++;
			}
		}
		$j++;
	}
	$i = 1;
}
?>
</table>
<input type='submit' value='提交'/>
<input type='reset' value='重置'/>
</form>